package com.csu.ds;

import com.csu.consts.UiConsts;

import javax.swing.*;
import java.awt.*;

public class TransactionItem {
    public JLabel label_trans_icon;
    public JLabel label_trans_person;
    public JLabel label_trans_type;
    public JLabel label_trans_amount;
    public JLabel label_trans_date;

    public TransactionItem() {
        label_trans_person = new JLabel();
        label_trans_type = new JLabel();
        label_trans_amount = new JLabel();
        label_trans_date = new JLabel();

        //icon根据type设定
        label_trans_icon = new JLabel();
        label_trans_icon.setOpaque(true);
        label_trans_icon.setBackground(Color.WHITE);

        //label字体设置
        label_trans_person.setFont(UiConsts.FONT_TRANS_TYPE);
        label_trans_type.setFont(UiConsts.FONT_TRANS_TYPE);
        label_trans_date.setFont(UiConsts.FONT_TRANS_TYPE);
        label_trans_date.setForeground(UiConsts.COLOR_LIGHT_GREY);
        label_trans_amount.setFont(UiConsts.FONT_TRANS_AMOUNT);
        label_trans_amount.setHorizontalTextPosition(JLabel.RIGHT);
    }

    public TransactionItem(String type, String source, String amount, String time ){
        label_trans_person = new JLabel(type);
        label_trans_type = new JLabel(source);
        label_trans_amount = new JLabel(amount);
        label_trans_date = new JLabel(time);

        //icon根据type设定
        label_trans_icon = new JLabel();
        label_trans_icon.setOpaque(true);
        label_trans_icon.setBackground(Color.WHITE);

        //label字体设置
        label_trans_person.setFont(UiConsts.FONT_TRANS_TYPE);
        label_trans_type.setFont(UiConsts.FONT_TRANS_TYPE);
        label_trans_date.setFont(UiConsts.FONT_TRANS_TYPE);
        label_trans_date.setForeground(UiConsts.COLOR_LIGHT_GREY);
        label_trans_amount.setFont(UiConsts.FONT_TRANS_AMOUNT);
        label_trans_amount.setHorizontalTextPosition(JLabel.RIGHT);


    }

}
